<template>
   <div class="box" v-if="adminToday.length>0">
      <div class="top">
         <div>
            <div class="top-left">
               <p>{{ adminToday[0].text1}}</p>
               <p>{{ adminToday[0].text2 }}</p>
               <p>{{ adminToday[0].text3 }}</p>
            </div>
            <div class="top-right">
               <span>{{ adminToday[0].text4 }}</span>
               <a>
                  <van-icon name="upgrade" color="#F8AFE6" size="20px"  @click="pushclick"/>
               </a>
            </div>
         </div>
         <div class="top-bottom">
            <img :src="adminToday[0].avatar"/>
            <span>{{ adminToday[0].user }}</span>
         </div>
         <div></div>
         <div></div>
      </div>
      <div class="content">
         <div class="content-left">
            <p>{{ adminToday[1].text1 }}</p>
            <p>{{ adminToday[1].text2 }}</p>
            <p>{{ adminToday[1].text3 }}</p>
         </div>
         <div class="content-right">
            <span>{{ adminToday[1].text4 }}</span>
            <a>
               <van-icon name="upgrade" color="#35E3F2" size="20px" @click="kecehng"/>
            </a>
         </div>
      </div>
      <div class="bottom">
         <div class="bottom-left">
            <p>{{adminToday[2].text1  }}</p>
            <p>{{  adminToday[2].text2}}</p>
            <p>{{ adminToday[2].text3 }}</p>
         </div>
         <div class="bottom-right">
            <span>{{ adminToday[2].text4.slice(0,4) }}</span>
            <br>
            <span>{{ adminToday[2].text4.slice(4) }}</span>
            <a>
               <van-icon name="upgrade" color="#AAB2BD" size="20px" @click="causeeend"/>
            </a>
         </div>
      </div>
      <div class="bottom1">
            <div>今日没有更多课程了哦</div>
            <div>
                <img src="@/img/button1.png">
            </div>
        </div>
   </div>
</template>

<script setup>
import { ref, onMounted } from 'vue'
import { adminTodayApi } from '@/api/adminAPi'
import { useRouter } from 'vue-router';
import adminStore from '@/store/admin'

const myadminStore = adminStore()
const router = useRouter();
let adminToday = ref([])
onMounted(async () => {
   let ret = await adminTodayApi()
   if (ret.code === 0) {
      adminToday.value = ret.data
   }
})
const pushclick =() =>{
   router.push('/singin');
   myadminStore.setUserInfo(false)
}
const kecehng =()=> {
   router.push('/kecheng');
   myadminStore.setUserInfo(false)
}
const causeeend =()=> {
   router.push('/causeeend');
   myadminStore.setUserInfo(false)
}
</script>
<style lang='scss' scoped>
.box {
   height: 100%;
   padding: 15px 35px 0 15px;
   overflow: hidden;
   .top {
      width: 100%;
      height: 150px;
      border-radius: 10px;
      position: relative;
      overflow: hidden;
      padding: 10px 8px;
      background-color: white;
      margin-bottom: 30px;
      box-shadow:  0 0 2px rgba(0, 0, 0, 0.5);

      div {
         &:nth-child(1) {
            display: flex;
            justify-content: space-between;

            .top-left {
               display: flex;
               flex-direction: column;

               p {
                  &:nth-child(1) {
                     font-size: 25px;
                     font-weight: 600;
                     color: white;
                     z-index: 2;
                  }

                  &:nth-child(2),
                  &:nth-child(3) {
                     font-size: 18px;
                     color: #BDC3C3;
                     margin-top: 10px;
                  }
               }
            }

            .top-right {
               margin-top: 30px;

               span {
                  font-weight: 600px;
                  font-size: 22px;
                  color: #F8AFE6;
                  margin-right: 10px;
               }

               a {
                  width: 10px;
                  height: 10px;
                  transform: rotate(90deg);
                  margin-top: -8px;
                  margin-left: 20px;
               }
            }
         }

         &:nth-child(2) {
            display: flex;
            align-items: center;
            margin-top: 10px;

            img {
               width: 30px;
               height: 30px;
               border-radius: 50%;
            }

            span {
               font-size: 18px;
               margin-left: 5px;
            }
         }

         &:nth-child(3) {
            width: 200px;
            height: 100px;
            background-color: #30E2F2;
            position: absolute;
            left: -20px;
            top: -50px;
            border-radius: 50%;
            z-index: 1;
         }

         &:nth-child(4) {
            width: 200px;
            height: 100px;
            background-color: #F9DF71;
            position: absolute;
            right: -60px;
            bottom: -50px;
            border-radius: 50%;
            z-index: 1;
         }
      }
   }

   .content {
      width: 100%;
      height: 100px;
      border-radius: 10px;
      position: relative;
      overflow: hidden;
      padding: 10px 8px;
      display: flex;
      background-color: white;
      justify-content: space-between;
      box-shadow:  0 0 2px rgba(0, 0, 0, 0.5);
      .content-left {
         display: flex;
         flex-direction: column;

         p {
            &:nth-child(1) {
               font-size: 25px;
               font-weight: 600;
               color: #3C3B3D;
            }

            &:nth-child(2),
            &:nth-child(3) {
               font-size: 18px;
               color: #BDC3C3;
               margin-top: 10px;
            }
         }
      }

      .content-right {
         margin-top: 30px;

         span {
            font-weight: 600px;
            font-size: 22px;
            color: #35E3F2;
            margin-right: 10px;
         }

         a {
            margin-top: -8px;
            margin-left: 20px;

            .van-icon {
               transform: rotate(90deg);
            }
         }
      }
   }

   .bottom {
      width: 100%;
      height: 100px;
      border-radius: 10px;
      position: relative;
      overflow: hidden;
      padding: 10px 8px;
      display: flex;
      background-color: white;
      justify-content: space-between;
      margin-top: 30px;
      box-shadow:  0 0 2px rgba(0, 0, 0, 0.5);
      .bottom-left {
         display: flex;
         flex-direction: column;

         p {
            &:nth-child(1) {
               font-size: 25px;
               font-weight: 600;
               color: #3C3B3D;
            }

            &:nth-child(2),
            &:nth-child(3) {
               font-size: 18px;
               color: #BDC3C3;
               margin-top: 10px;
            }
         }
      }

      .bottom-right {
         margin-top: 30px;
         span {
            font-weight: 600px;
            font-size: 18px;
            color: #AAB2BD;
            margin-right: 10px;
         }

         a {
            .van-icon {
               transform: rotate(90deg);
            }
         }
      }
   }
   .bottom1{
    div{
        &:nth-child(1){
            display: flex;
            justify-content: center;
            color: gray;
            margin-top: 35px;
        }
        &:nth-child(2){
            margin-top:20px;
            img{
                width: 100%;
                height: 100px;
                background-color: #54a7fa;
                border-radius: 40%;
            }
        }
    }
}
}
</style>